//test
import api from'../api'
import {
  SET_USER,
  SET_MSG
} from './types'
export default {
  getUserInfo({commit, state}) {
    console.log("getme!!")
    api.getMe().then(response => {
      commit(SET_MSG,response.data.message)
      if (response.data.code!==0){
        return
      }else {
        // setStore('token',response.data.token)
        commit(SET_MSG,"欢迎您回来！")
        // console.log(response.data.Data)
        return commit(SET_USER, {
          userInfo: response.data.Data.userinfo,
          userprof: response.data.Data.userprof,
          role: response.data.Data.role,
          org: response.data.Data.org,
          dept:response.data.Data.dept,
          token: response.data.token,
          accesslist: response.data.Data.accesslist.children
        })
      }

    }, err => {

    })
  },

}
